<?php
namespace app\index\model;

use think\Model;

class LoginListModel extends Model
{

    protected $table = 'newzs_loginlist';


    public static function add_row($user, $ip, $type, $status){
        $dept = DeptModel::get_name_by_ids($user['deptid']);
        $role = UserRoleModel::get_name_by_ids($user['roleid']);
        $data = [
            'comid' => $user['comid'],
            'uid' => $user['id'],
            'realname' => $user['realname'],
            'tel' => $user['tel'],
            'dept' => $dept,
            'role' => $role,
            'ip' => $ip,
            'type' => $type,
            'status' => $status,
            'optdt' => date('Y-m-d H:i:s'),
        ];
        return self::create($data);
    }



}
